<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    var total=prompt('请输入班级总人数');
    var sum=0;
    var avg=0;
    for(var i = 1;i <= total;i++){
        var number=parseFloat(prompt('请输入第'+i+'同学成绩'));
        sum = sum + number;
        avg = sum / total;
    }
    alert('学生总成绩为：'+sum);
    alert('学生平均分为：'+avg);
</script>
<body>

</body>
</html>